package cn.jiyun.service.impl;

import cn.jiyun.common.config.Result;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.jiyun.entity.Yjqj;
import cn.jiyun.service.YjqjService;
import cn.jiyun.mapper.YjqjMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 小九
 * @description 针对表【yjqj】的数据库操作Service实现
 * @createDate 2024-10-29 09:49:40
 */
@Service
public class YjqjServiceImpl extends ServiceImpl<YjqjMapper, Yjqj>
        implements YjqjService {


@Autowired
private YjqjMapper yjqjMapper;


    @Override
    public Page findPage(Integer pageNum, Integer pageSize, Yjqj yjqj) {
        Page yjqjPage = new Page<>(pageNum, pageSize);
        LambdaQueryWrapper<Yjqj> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(yjqj.getName()!=null,Yjqj::getName,yjqj.getName());
        wrapper.like(yjqj.getSex()!=null,Yjqj::getSex,yjqj.getSex());
        wrapper.like(yjqj.getCert()!=null,Yjqj::getCert,yjqj.getCert());
        wrapper.like(yjqj.getAddress()!=null,Yjqj::getAddress,yjqj.getAddress());
        Page selectPage1=baseMapper.selectPage(yjqjPage,wrapper);
        return selectPage1;
    }

    @Override
    public Yjqj findId(Integer id) {
        Yjqj yjqj = yjqjMapper.selectById(id);
        return yjqj;
    }
}




